using System;
using Synapse.Framework.Pipe.BusinessObjects;

namespace Synapse.Framework.Pipe.Operations
{
    public class OperationFuncAdapter<TInput, TOutput> : IOperation<TInput,TOutput>
    {
        private readonly Func<TInput, TOutput> operation;

        public OperationFuncAdapter(Func<TInput,TOutput> operation)
        {
            this.operation = operation;
        }

        public _<TOutput> Process(TInput input)
        {
            return operation(input);
        }
    }

    public class OperationFunc<TInput, TOutput> : IOperation<TInput, TOutput>
    {
        private readonly Func<TInput, _<TOutput>> operation;

        public OperationFunc(Func<TInput, _<TOutput>> operation)
        {
            this.operation = operation;
        }

        public _<TOutput> Process(TInput input)
        {
            return operation(input);
        }
    }
}